<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('base/common-header', TEMPLATE_INCLUDEPATH)) : (include template('base/common-header', TEMPLATE_INCLUDEPATH));?>
<style>
    .share-msg-config{width:300px;height:135px;border:1px solid #eee;background:#fefefe;border-radius:2px;box-sizing:border-box;padding:8px;}
    .share-msg-config-box{position:relative;height:100%;}
    .share-msg-config-title{position:absolute;top:0;left:0;margin-right:0;font-size:18px;width:100%;height:50px;overflow:hidden;word-wrap:break-word;word-break:break-all;resize:none;border:none;background:inherit;outline:none;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;}
    .share-msg-config-desc{position:absolute;bottom:0;left:0;width:calc(100% - 60px - 8px);height:60px;margin:0;color:#aaa;word-wrap:break-word;word-break:break-all;overflow:hidden;resize:none;border:none;background:inherit;outline:none}
    .share-msg-config-cover{position:absolute;right:0;bottom:0;width:60px;height:60px;overflow:hidden;cursor:pointer;}
    .share-msg-config-cover img{width:100%;height:100%;}
    .radio-child{margin:20px}
    .design_status3 [type=radio]{position:relative}
    .design_status3 label{margin:0 14px 14px} 
</style>
    <!-- 添加信息表单 -->
<form id="form" name="form" class="form-horizontal ajax-form confirm" method="post" action="<?php  echo aurl('update')?>" enctype="multipart/form-data" data-tolink="<?php  echo aurl('index')?>">

    <input type="hidden" name="act_id" value="<?php  echo $act_row['id'];?>">
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">添加信息</a></li>
        <li role="presentation"><a href="#share" aria-controls="share" role="tab" data-toggle="tab">分享信息</a></li>
        <li role="presentation"><a href="#skill" aria-controls="profile" role="tab" data-toggle="tab">返利信息</a></li>
    </ul>
    <div class="tab-content">

        <!-- 首页 -->
        <div role="tabpanel" class="tab-pane active" id="home">
            <!-- 单项 -->
            <div class="form-group">
                <label class="col-sm-2 control-label">活动标题：</label>
                <div class="col-sm-10">
                    <input type="text" name="act_name" class="form-control" id="act_name" value="<?php  echo $act_row['active_name'];?>">
                    <div class="help-block">请输入活动标题</div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">客服电话：</label>
                <div class="col-sm-10">
                    <input type="text" name="service_mobile"  class="form-control" id="service_mobile" value="<?php  echo $act_row['service_mobile'];?>">
                    <div class="help-block">请输入客服电话</div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">单人价格：</label>
                <div class="col-sm-10">
                    <input type="text" name="personal_price" class="form-control" id="personal_price" value="<?php  echo $act_row['personal_price'];?>">
                    <div class="help-block">请输入单人购买的价格</div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">团购人数：</label>
                <div class="col-sm-10">
                    <input type="text" name="group_num" class="form-control" id="group_num" value="<?php  echo $act_row['group_num'];?>">
                    <div class="help-block">请输入团购人数</div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">团购价格：</label>
                <div class="col-sm-10">
                    <input type="text" name="group_price" class="form-control" id="group_price" value="<?php  echo $act_row['group_price'];?>">
                    <div class="help-block">请输入开团价格</div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">预付款价格：</label>
                <div class="col-sm-10">
                    <input type="text" name="pay_price" class="form-control" id="pay_price" value="<?php  echo $act_row['pay_price'];?>">
                    <div class="help-block">请输入预付款价格</div>
                </div>
            </div>
            
            <div class="form-group">
                <label class="col-sm-2 control-label">背景音乐：</label>
                <div class="col-sm-10">
                    <?php  echo tpl_form_field_audio('bg_music',$act_row['bg_music'])?>
                    <div class="help-block">请输入活动背景音乐</div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">活动首页：</label>
                <div class="col-sm-10">
                    <?php  echo tpl_form_field_image('cover_img', $act_row['cover_img'])?>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">显示内容：</label>
                <div class="col-sm-10 limithigh">
                    <?php  echo tpl_ueditor('desc', $act_row['desc'])?>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">活动开始时间：</label>
                <div class="col-sm-10">
                    <?php  echo _tpl_form_field_date('start_time', $act_row['start_time'])?>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">活动结束时间：</label>
                <div class="col-sm-10">
                    <?php  echo _tpl_form_field_date('end_time', $act_row['end_time'])?>
                </div>
            </div>
        </div>
        <div role="tabpanel" class="tab-pane" id="share">
            <div class="form-group">
                <label class="col-xs-2 control-label text-right">分享给朋友/朋友圈：</label>
                <div class="col-xs-10">
                    <div class="share-msg-config">
                        <div class="share-msg-config-box">
                        <textarea name="share_title" id="share_title" class="share-msg-config-title" placeholder="请填写分享名称！"><?php  echo $act_row['share_title'];?></textarea>
                            <textarea name="share_content" id="share_content" class="share-msg-config-desc" placeholder="请填写分享描述"><?php  echo $act_row['share_content'];?></textarea>
                            <!-- <div class="share-msg-config-cover share-msg-config-upload">
                                <img src="<?php  echo tomedia($row['share_image']);?>">
                                <input type="hidden" name="share_image" id="share_image" value="<?php  echo $row['share_image'];?>">
                            </div> -->
                    </div>
                </div>
                <p class="help-block">
                    1. 名称不填默认为活动标题<br>
                    2. 描述默认为是：我报名了%ACTIVE%，快来与我一起参加吧！<br>
                    
                </p>
                </div>
            </div>
    
        </div>
        <div role="tabpanel" class="tab-pane" id="skill">

            <!-- 摇奖 -->
            <div class="form-group">
                <label class="col-xs-2 control-label text-right">摇奖返利：</label>
                <div class="col-xs-10">
                    <select name="skill_status" id="skill_status">
                        <option value="off" <?php  if($act_row['skill_status']=='off') { ?>selected='selected' <?php  } ?>>
                            关闭&emsp;
                        </option>
                        <option value="on" <?php  if($act_row['skill_status']=='on') { ?>selected='selected' <?php  } ?>>
                            开启&emsp;
                        </option>
                    </select>
                    <p class="help-block">
                        *默认为关闭状态，
                    </p>
                </div>
            </div>
            <div id="skill_div" style="display:none">
                <div class="form-group">
                    <label class="col-xs-2 control-label text-right"></label>
                    <div class="col-xs-10">
                        客户&nbsp;
                        <select name="apply_status">
                            <option value="on" <?php  if($act_row['apply_status']=='on') { ?>selected='selected' <?php  } ?>>
                                需要报名&emsp;
                            </option>
                            <option value="off" <?php  if($act_row['apply_status']=='off') { ?>selected='selected' <?php  } ?>>
                                无需报名&emsp;
                            </option>
                        </select>
                        &nbsp;参与摇奖，返利区间&nbsp;
                        <input type="text" name="skill_reward_min" class="form-control" placeholder="最小返利奖金" style="width: 10%;display: inline;" value="<?php echo $act_row['skill_reward_min'] ?: 0.3?>">&nbsp;-&nbsp;
                        
                        <input type="text"  name="skill_reward_max" class="form-control" placeholder="最大返利奖金" style="width:10%;display: inline;" value="<?php echo $act_row['skill_reward_max'] ?: 1?>">&nbsp;元
                        <p class="help-block">
                            
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-2 control-label text-right"></label>
                    <div class="col-xs-10">
                        
                        <select name="send_type" id="skill_send_type">
                            <option value="transfers" <?php  if($act_row['send_type']=='transfers') { ?>selected='selected' <?php  } ?>>
                                微信企业付款&nbsp;
                            </option>
                            <option value="redpack" <?php  if($act_row['send_type']=='redpack') { ?>selected='selected' <?php  } ?>>
                                微信现金红包&nbsp;
                            </option>
                        </select>

                        <p class="help-block">
                            
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <div id="skill_redpack_div">
                        <label class="col-xs-3 control-label text-right">活动名称：</label>
                        <div class="col-xs-9" style="padding-bottom: 15px">
                            <input type="text"  name="skill_pack_name" class="form-control" placeholder="请输入活动名称" style="width:30%;display: inline;" value="<?php  echo $act_row['skill_pack_name'];?>">&nbsp;
                            <p class="help-block">
                                * 必填，否则红包发送失败
                            </p>
                        </div>

                        <label class="col-xs-3 control-label text-right">发送人名称：</label>
                        <div class="col-xs-9" style="padding-bottom: 15px">
                            <input type="text"  name="skill_pack_sender" class="form-control" placeholder="请输入发送人名称" style="width:30%;display: inline;" value="<?php  echo $act_row['skill_pack_sender'];?>">&nbsp;
                            <p class="help-block">
                                * 必填，否则红包发送失败
                            </p>
                        </div>
                        <label class="col-xs-3 control-label text-right">红包祝福语：</label>
                        <div class="col-xs-9" style="padding-bottom: 15px">
                            <input type="text"  name="skill_pack_wishing" class="form-control" placeholder="请输入红包祝福语" style="width:80%;display: inline;" value="<?php  echo $act_row['skill_pack_wishing'];?>">&nbsp;
                            <p class="help-block">
                                * 必填，否则红包发送失败
                            </p>
                        </div>
                    </div>

                    <label class="col-xs-3 control-label text-right">发放备注：</label>
                    <div class="col-xs-9">
                        <input type="text"  name="skill_pack_remark" class="form-control" placeholder="请输入发放备注" style="width:80%;display: inline;" value="<?php  echo $act_row['skill_pack_remark'];?>">&nbsp;
                        <p class="help-block">
                            * 必填，否则红包发送失败
                        </p>
                    </div>
                </div>
            </div>

            <!-- 分享 -->
            <div class="form-group">
                <label class="col-xs-2 control-label text-right">推荐返利：</label>
                <div class="col-xs-10">
                    <select name="recommend_status" id="recommend_status">
                        <option value="off" <?php  if($act_row['recommend_status']=='off') { ?>selected='selected' <?php  } ?>>
                            关闭&emsp;
                        </option>
                        <option value="on" <?php  if($act_row['recommend_status']=='on') { ?>selected='selected' <?php  } ?>>
                            开启&emsp;
                        </option>
                    </select>
                    <p class="help-block">
                        *默认为关闭状态，
                    </p>
                </div>
            </div>
            <div id="recommend_div" style="display:none">
                <div class="form-group">
                    <label class="col-xs-2 control-label text-right"></label>
                    <div class="col-xs-10">
                        推荐人&nbsp;
                        <select name="recommend_apply_status">
                            <option value="on" <?php  if($act_row['recommend_apply_status']=='on') { ?>selected='selected' <?php  } ?>>
                                需要报名&emsp;
                            </option>
                            <option value="off" <?php  if($act_row['recommend_apply_status']=='off') { ?>selected='selected' <?php  } ?>>
                                无需报名&emsp;
                            </option>
                        </select>
                        &nbsp;参与推荐返利，被推荐人报名付款成功后可获得&nbsp;
                        <input type="text" name="recommend_reward_min" class="form-control" placeholder="最小返利奖金" style="width: 10%;display: inline;" value="<?php echo $act_row['recommend_reward_min'] ?: 0.3?>">&nbsp;-&nbsp;
                        
                        <input type="text"  name="recommend_reward_max" class="form-control" placeholder="最大返利奖金" style="width:10%;display: inline;" value="<?php echo $act_row['recommend_reward_max'] ?: 1?>">&nbsp;元
                        <p class="help-block">
                            
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-2 control-label text-right"></label>
                    <div class="col-xs-10">
                        
                        <select name="recommend_send_type" id="recommend_send_type">
                            <option value="transfers" <?php  if($act_row['recommend_send_type']=='transfers') { ?>selected='selected' <?php  } ?>>
                                微信企业付款&nbsp;
                            </option>
                            <option value="redpack" <?php  if($act_row['recommend_send_type']=='redpack') { ?>selected='selected' <?php  } ?>>
                                微信现金红包&nbsp;
                            </option>
                        </select>

                        <p class="help-block">
                            
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <div id="recommend_redpack_div">
                        
                        <label class="col-xs-3 control-label text-right">活动名称：</label>
                        <div class="col-xs-9" style="padding-bottom: 15px">
                            <input type="text" name="recommend_pack_name" class="form-control" placeholder="请输入活动名称" style="width:30%;display: inline;" value="<?php  echo $act_row['recommend_pack_name'];?>">&nbsp;
                            <p class="help-block">
                                * 必填，否则红包发送失败
                            </p>
                        </div>

                        <label class="col-xs-3 control-label text-right">发送人名称：</label>
                        <div class="col-xs-9" style="padding-bottom: 15px">
                            <input type="text" name="recommend_pack_sender" class="form-control" placeholder="请输入发送人名称" style="width:30%;display: inline;" value="<?php  echo $act_row['recommend_pack_sender'];?>">&nbsp;
                            <p class="help-block">
                                * 必填，否则红包发送失败
                            </p>
                        </div>
                        <label class="col-xs-3 control-label text-right">红包祝福语：</label>
                        <div class="col-xs-9" style="padding-bottom: 15px">
                            <input type="text" name="recommend_pack_wishing" class="form-control" placeholder="请输入红包祝福语" style="width:80%;display: inline;" value="<?php  echo $act_row['recommend_pack_wishing'];?>">&nbsp;
                            <p class="help-block">
                                * 必填，否则红包发送失败
                            </p>
                        </div>
                    </div>  

                    <label class="col-xs-3 control-label text-right">发放备注：</label>
                    <div class="col-xs-9">
                        <input type="text" name="recommend_pack_remark" class="form-control" placeholder="请输入发放备注" style="width:80%;display: inline;" value="<?php  echo $act_row['recommend_pack_remark'];?>">&nbsp;
                        <p class="help-block">
                            * 必填，否则红包发送失败
                        </p>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-success" id="btn">保存</button>
            </div>
        </div>
    </div>
</form>
<script>
    $(function() {

        // 摇奖
        if($('#skill_status').val() === 'on') {
            $('#skill_div').css('display', 'block');
            if($('#skill_send_type').val() === 'redpack') {
                $('#skill_redpack_div').css('display', 'block')
            } else {
                $('#skill_redpack_div').css('display', 'none')
            }
            $('#skill_send_type').on('change', function() {
                if($('#skill_send_type').val() === 'redpack') {
                $('#skill_redpack_div').css('display', 'block')
                } else {
                    $('#skill_redpack_div').css('display', 'none')
                }
            })
        } else {
            $('#skill_div').css('display', 'none')
        }
        $('#skill_status').on('change', function() {
            if($('#skill_status').val() === 'on') {
                $('#skill_div').css('display', 'block');
                if($('#skill_send_type').val() === 'redpack') {
                    $('#skill_redpack_div').css('display', 'block')
                } else {
                    $('#skill_redpack_div').css('display', 'none')
                }
                $('#skill_send_type').on('change', function() {
                    if($('#skill_send_type').val() === 'redpack') {
                    $('#skill_redpack_div').css('display', 'block')
                    } else {
                        $('#skill_redpack_div').css('display', 'none')
                    }
                })
            } else {
                $('#skill_div').css('display', 'none')
            }
        })

        // 推荐
        if($('#recommend_status').val() === 'on') {
            $('#recommend_div').css('display', 'block');
            if($('#recommend_send_type').val() === 'redpack') {
                $('#recommend_redpack_div').css('display', 'block')
            } else {
                $('#recommend_redpack_div').css('display', 'none')
            }
            $('#recommend_send_type').on('change', function() {
                if($('#recommend_send_type').val() === 'redpack') {
                $('#recommend_redpack_div').css('display', 'block')
                } else {
                    $('#recommend_redpack_div').css('display', 'none')
                }
            })
        } else {
            $('#recommend_div').css('display', 'none')
        }
        $('#recommend_status').on('change', function() {
            if($('#recommend_status').val() === 'on') {
                $('#recommend_div').css('display', 'block');
                if($('#recommend_send_type').val() === 'redpack') {
                    $('#recommend_redpack_div').css('display', 'block')
                } else {
                    $('#recommend_redpack_div').css('display', 'none')
                }
                $('#recommend_send_type').on('change', function() {
                    if($('#recommend_send_type').val() === 'redpack') {
                    $('#recommend_redpack_div').css('display', 'block')
                    } else {
                        $('#recommend_redpack_div').css('display', 'none')
                    }
                })
            } else {
                $('#recommend_div').css('display', 'none')
            }
        })

        
    })
</script>
<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('base/common-footer', TEMPLATE_INCLUDEPATH)) : (include template('base/common-footer', TEMPLATE_INCLUDEPATH));?>
